home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / FILER / X-FILES.ZIP / 057 / !X-Files / c / fshook < prev    next >
Text File  |  1996-04-04  |  724b  |  44 lines

  1. /* fshook.c */
  2.  
  3. #include "kernel.h"
  4. #include "swis.h"
  5. #include "debug.h"
  6. #include <stdlib.h>
  7.  
  8. #include "fshook.h"
  9.  
  10. extern void *wsp;
  11.  
  12. extern void RealFileHook(void);
  13.  
  14. _kernel_oserror *FileHook(_kernel_swi_regs *r)
  15. {
  16.    TRACE("OS_File %d, \"%s\"\n", r->r[0], (const char *) r->r[1]);
  17.  
  18.    return NULL;
  19. }
  20.  
  21. static void RemoveFSHook(void)
  22. {
  23.    _kernel_swi_regs regs;
  24.  
  25.    regs.r[0] = (int) 8;
  26.    regs.r[1] = (int) RealFileHook;
  27.    regs.r[2] = (int) wsp;
  28.  
  29.    (void) _kernel_swi(OS_Release, ®s, ®s);
  30. }
  31.  
  32. _kernel_oserror *InstallFSHook()
  33. {
  34.    _kernel_swi_regs regs;
  35.  
  36.    atexit(RemoveFSHook);
  37.  
  38.    regs.r[0] = (int) 8;
  39.    regs.r[1] = (int) RealFileHook;
  40.    regs.r[2] = (int) wsp;
  41.  
  42.    return _kernel_swi(OS_Claim, ®s, ®s);
  43. }
  44.